/*
 * JTableDownload.java
 *
 * Created on 19 janvier 2008, 21:10
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package flickr;

import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author Administrateur
 */
public class JTableDownload extends JTable {
    JTableDownloadModel model;
    
    /** Creates a new instance of JTableStack */
    public JTableDownload(JTableDownloadModel model) {
        super(model);
        this.model = model;

        setRowHeight(10);
        // setTableHeader(null);
        
        setFillsViewportHeight(true);   // rempli tout le Scroll ^^
        // setAutoCreateRowSorter(true);
        setRowHeight(100);
        setShowVerticalLines(false);
        setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        setAutoResizeMode(AUTO_RESIZE_OFF);
        
        
        // centre les titres des colonnes
        ((DefaultTableCellRenderer)getTableHeader().getDefaultRenderer()).setHorizontalAlignment(SwingConstants.CENTER);
        
        for(int i=0;i < getColumnModel().getColumnCount(); i++) {
            switch(i){
                case 0: getColumnModel().getColumn(i).setPreferredWidth(100);;break;
                case 1: getColumnModel().getColumn(i).setPreferredWidth(130);;break;
                case 2: getColumnModel().getColumn(i).setPreferredWidth(60);;break;
                case 3: getColumnModel().getColumn(i).setPreferredWidth(300);;break;
                //  case 4: getColumnModel().getColumn(i).setPreferredWidth(100);;break;
            }
        }
        
  
        
        model.setTable(this);
        
    }
    
    
    
}

